#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
    
    int arr1[2][3];
    int arr2[2][3];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            scanf("%d", &arr1[i][j]);
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            scanf("%d", &arr2[i][j]);
        }

    }
    int flag = 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            if (arr1[i][j] != arr2[i][j])
            {
                flag = 0;
            }
        }
    }
    if (flag == 1)
        printf("Yes");
    else
        printf("No");
    return 0;
}
